#include<iostream>
#include<unordered_set>
using namespace std;



int main()
{
	int _size; scanf("%d", &_size);
	while(_size--)
	{
		unordered_set<int> mp;
		int n; scanf("%d", &n);
		while(n--)
		{
			int num; scanf("%d", &num);
			auto ch=mp.find(num);
			if(ch!=mp.end())
			{
				continue;
			}
			else
			{
				printf("%d ", num);
				mp.insert(num);
			}
		}
		printf("\n");
	}
	return 0;
}
